<!-- spring-task -->

<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
    $(function() {
        $(".invoke").on("click", function() {
            if(!confirm("确定要执行任务?")) {
                return;
            }

            $.ajax({
                url : location.href,
                type: 'POST',
                data: {
                    action: "invoke",
                    beanType: $(this).data("beantype"),
                    methodName: $(this).data("methodname")
                }
            }).then(function(resp) {
                alert("已执行 " + resp);
            });
        });
    });
</script>
</head>
<body>
    <h2>所有 spring-task</h2>
    <#list scheduledMethods as each>
        <div>
            <span>${each_index + 1}. ${each.beanType}.${each.methodName}</span>
            <br/>
            <button class="invoke" data-beantype="${each.beanType}" data-methodname="${each.methodName}">执行这个任务</button>
            <br/>
            <br/>
        </div>
    </#list>
</body>